import React from "react"
import styles from './tagbtn.less'
export default class Tagbtn extends React.Component {

    handleClick = (tagId) => {
        const { tagClick } = this.props
        tagClick(tagId)
    }

    render() {
        const { tag, selectedTag } = this.props
        const isActive = selectedTag === tag.tagId ? true : false
        return (
                <div className={isActive ? styles.tagActive : styles.tag} onClick={() => { this.handleClick(tag.tagId) }}>
                    <span>{tag.tagName}</span>
                </div>
        )
    }
}
